/* 
 * Copyright [2017] [Alex/LiBo(libo2dev.aliyun.com/alex.link@foxmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.bind.injector;

import java.util.Set;

import com.google.inject.Key;
import com.hyts.bind.base.BaseInjector;
import com.hyts.bind.binder.BinderService;
import com.hyts.bind.domain.BindDomain;
import com.hyts.bind.domain.BindDomains;

/**  
 * @Title DefaultBootStrapInjector.java  
 * @Package com.hyts.bind.injector  
 * @Description 默认操作服务启动依赖注入操作控制器  
 * @author LiBo/Alex  
 * @date 2017年10月25日  
 * @version V1.0  
 */
public final class DefaultClassInjector extends BaseInjector{
	
	
		private static DefaultClassInjector  singleSubject = new DefaultClassInjector();
		
		
		public static DefaultClassInjector getInstance(){
			return singleSubject;
		}
		
		/**  
		 * 创建一个新的实例-构造器 DefaultClassInjector.  
		 */
	
		public DefaultClassInjector() {
			super();
		}

		/**  
		 * @Title: build  
		 * @Description: 开始启动服务，依赖注入服务
		 * @return void 返回类型
		 * @throws  
		 */ 
		@Deprecated
		private BaseInjector build() {	
			this.init();
			return this;
		}
		
		/**  
		 * initBinding
		 * <b>initBind增添绑定对象</b>
		 * <p>初始化对象绑定对象操作</p>
		 * @param domains
		 * @return
		 * @exception
		 */ 
		public BaseInjector initBinding(BindDomains domains){
			defaultBindDomains = domains;
	        this.init();
			return this;
		}
		
		/**  
		 * <b>initBind增添绑定对象</b>
		 * <p>初始化对象绑定对象操作</p>
		 * @return
		 * @exception
		 */
		@Deprecated
		public DefaultClassInjector initBind(){
		    throw new UnsupportedOperationException("过期方法不支持，请调用com.hyts.bind.injector.DefaultClassInjector.initBind(BindDomains)");
/*			defaultBindDomains = new BindDomains();
			return this;*/
		}
		
		/**  
		 * <b>addBind增添绑定对象</b>
		 * <p>添加绑定对象操作</p>
		 * @param domain 绑定域
		 * @return
		 * @exception
		 */ 
		public DefaultClassInjector addBind(BindDomain domain){
			defaultBindDomains.addBindSubject(domain);
			return this;
		}
		
		/**  
		 * <b>addBind增添绑定对象</b>
		 * <p>添加绑定对象操作</p>
		 * @param interfaceClass 接口类
		 * @param implementClass 接口实现类
		 * @return
		 * @exception
		 */ 
		public DefaultClassInjector addBind(Class<?> interfaceClass,Class<?> implementClass){
			defaultBindDomains.addBindSubject(interfaceClass, implementClass);
			return this;
		}
		
}
